/********************************************************************
FileName    :   Dal_xskdB.cs
CreateTime  :   2019-01-17 01:01
BaseClass   :   Dal_xskdB
FileType    :   .cs
Author      :  minjie
Description :   Dal_xskdBDAL层（简单三层）
*********************************************************************/

using System;
using System.Text;
using System.Data.SqlClient;
using System.Collections.Generic;

using System.Data;
using HT.DBUtility;

namespace HT.DAL
{
	/// <summary>
	/// Dal_xskdB的摘要说明。
	/// </summary>
	public partial class Dal_xskdB 
  	{ 
     		      
  		public bool Exists() 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("select count(1) from xskdB"); 
           SqlParameter[] parameters = { };  
          			return DbHelperSQL.Exists(strSql.ToString(),parameters); 
  		} 
  		 
  				 
  		 
  		/// <summary> 
  		/// 增加一条数据 
  		/// </summary> 
  		public  bool  Add(xskdB_Entity model) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("insert into xskdB(");			 
  	        strSql.Append("DjLsh,DjBth,DjState,hh,tmh,spbh,spmc,gg,dw,sl,Dj,pfj,hyzk,hyyh,zyhjg,kcsl,je,hxsdh,yyy,jj,ysbh,ysmc,cm) values ("); 
  	        strSql.Append("	@DjLsh,@DjBth,@DjState,@hh,@tmh,@spbh,@spmc,@gg,@dw,@sl,@Dj,@pfj,@hyzk,@hyyh,@zyhjg,@kcsl,@je,@hxsdh,@yyy,@jj,@ysbh,@ysmc,@cm	 ) "); 
  			SqlParameter[] parameters = { 
              new SqlParameter("@DjLsh", SqlDbType.Int,4) ,              
              new SqlParameter("@DjBth", SqlDbType.Int,4) ,              
              new SqlParameter("@DjState", SqlDbType.Char,10) ,              
              new SqlParameter("@hh", SqlDbType.Int,4) ,              
              new SqlParameter("@tmh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@spbh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@spmc", SqlDbType.VarChar,50) ,              
              new SqlParameter("@gg", SqlDbType.VarChar,50) ,              
              new SqlParameter("@dw", SqlDbType.VarChar,50) ,              
              new SqlParameter("@sl", SqlDbType.Decimal,9) ,              
              new SqlParameter("@Dj", SqlDbType.Money) ,              
              new SqlParameter("@pfj", SqlDbType.Money) ,              
              new SqlParameter("@hyzk", SqlDbType.Decimal,9) ,              
              new SqlParameter("@hyyh", SqlDbType.Decimal,9) ,              
              new SqlParameter("@zyhjg", SqlDbType.Money) ,              
              new SqlParameter("@kcsl", SqlDbType.Decimal,9) ,              
              new SqlParameter("@je", SqlDbType.Money) ,              
              new SqlParameter("@hxsdh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@yyy", SqlDbType.VarChar,50) ,              
              new SqlParameter("@jj", SqlDbType.Decimal,9) ,              
              new SqlParameter("@ysbh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@ysmc", SqlDbType.VarChar,50) ,              
              new SqlParameter("@cm", SqlDbType.VarChar,50)};             
              parameters[0].Value = model.DjLsh;  
              
              parameters[1].Value = model.DjBth;  
              
           if (model.DjState != null)  
              parameters[2].Value = model.DjState;  
           else  
              parameters[2].Value = DBNull.Value;  
              
              parameters[3].Value = model.hh;  
              
           if (model.tmh != null)  
              parameters[4].Value = model.tmh;  
           else  
              parameters[4].Value = DBNull.Value;  
              
           if (model.spbh != null)  
              parameters[5].Value = model.spbh;  
           else  
              parameters[5].Value = DBNull.Value;  
              
           if (model.spmc != null)  
              parameters[6].Value = model.spmc;  
           else  
              parameters[6].Value = DBNull.Value;  
              
           if (model.gg != null)  
              parameters[7].Value = model.gg;  
           else  
              parameters[7].Value = DBNull.Value;  
              
           if (model.dw != null)  
              parameters[8].Value = model.dw;  
           else  
              parameters[8].Value = DBNull.Value;  
              
           if (model.sl != null)  
              parameters[9].Value = model.sl;  
           else  
              parameters[9].Value = DBNull.Value;  
              
           if (model.Dj != null)  
              parameters[10].Value = model.Dj;  
           else  
              parameters[10].Value = DBNull.Value;  
              
           if (model.pfj != null)  
              parameters[11].Value = model.pfj;  
           else  
              parameters[11].Value = DBNull.Value;  
              
           if (model.hyzk != null)  
              parameters[12].Value = model.hyzk;  
           else  
              parameters[12].Value = DBNull.Value;  
              
           if (model.hyyh != null)  
              parameters[13].Value = model.hyyh;  
           else  
              parameters[13].Value = DBNull.Value;  
              
           if (model.zyhjg != null)  
              parameters[14].Value = model.zyhjg;  
           else  
              parameters[14].Value = DBNull.Value;  
              
           if (model.kcsl != null)  
              parameters[15].Value = model.kcsl;  
           else  
              parameters[15].Value = DBNull.Value;  
              
           if (model.je != null)  
              parameters[16].Value = model.je;  
           else  
              parameters[16].Value = DBNull.Value;  
              
           if (model.hxsdh != null)  
              parameters[17].Value = model.hxsdh;  
           else  
              parameters[17].Value = DBNull.Value;  
              
           if (model.yyy != null)  
              parameters[18].Value = model.yyy;  
           else  
              parameters[18].Value = DBNull.Value;  
              
           if (model.jj != null)  
              parameters[19].Value = model.jj;  
           else  
              parameters[19].Value = DBNull.Value;  
              
           if (model.ysbh != null)  
              parameters[20].Value = model.ysbh;  
           else  
              parameters[20].Value = DBNull.Value;  
              
           if (model.ysmc != null)  
              parameters[21].Value = model.ysmc;  
           else  
              parameters[21].Value = DBNull.Value;  
              
           if (model.cm != null)  
              parameters[22].Value = model.cm;  
           else  
              parameters[22].Value = DBNull.Value;  
              
  			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);			 
  			if (rows > 0) 
  			{ 
  				return true; 
  			} 
  			else 
  			{ 
              return false;; 
           }  
  		} 
  		 
  		/// <summary> 
  		/// 增加一条数据(字符串) 
  		/// </summary> 
  		public  string  AddStr(xskdB_Entity model) 
  		{ 
  				if(model.DjLsh==null) 
  				{ 
  					model.DjLsh=0; 
  				} 
  				if(model.DjBth==null) 
  				{ 
  					model.DjBth=0; 
  				} 
  				if(model.DjState==null) 
  				{ 
  					model.DjState="";  
  				} 
  				if(model.hh==null) 
  				{ 
  					model.hh=0; 
  				} 
  				if(model.tmh==null) 
  				{ 
  					model.tmh="";  
  				} 
  				if(model.spbh==null) 
  				{ 
  					model.spbh="";  
  				} 
  				if(model.spmc==null) 
  				{ 
  					model.spmc="";  
  				} 
  				if(model.gg==null) 
  				{ 
  					model.gg="";  
  				} 
  				if(model.dw==null) 
  				{ 
  					model.dw="";  
  				} 
  				if(model.sl==null) 
  				{ 
  					model.sl=0; 
  				} 
  				if(model.Dj==null) 
  				{ 
  					model.Dj=0; 
  				} 
  				if(model.pfj==null) 
  				{ 
  					model.pfj=0; 
  				} 
  				if(model.hyzk==null) 
  				{ 
  					model.hyzk=0; 
  				} 
  				if(model.hyyh==null) 
  				{ 
  					model.hyyh=0; 
  				} 
  				if(model.zyhjg==null) 
  				{ 
  					model.zyhjg=0; 
  				} 
  				if(model.kcsl==null) 
  				{ 
  					model.kcsl=0; 
  				} 
  				if(model.je==null) 
  				{ 
  					model.je=0; 
  				} 
  				if(model.hxsdh==null) 
  				{ 
  					model.hxsdh="";  
  				} 
  				if(model.yyy==null) 
  				{ 
  					model.yyy="";  
  				} 
  				if(model.xh==null) 
  				{ 
  					model.xh=0; 
  				} 
  				if(model.jj==null) 
  				{ 
  					model.jj=0; 
  				} 
  				if(model.ysbh==null) 
  				{ 
  					model.ysbh="";  
  				} 
  				if(model.ysmc==null) 
  				{ 
  					model.ysmc="";  
  				} 
  				if(model.cm==null) 
  				{ 
  					model.cm="";  
  				} 
  		 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("insert into xskdB(");			 
  	        strSql.Append("DjLsh,DjBth,DjState,hh,tmh,spbh,spmc,gg,dw,sl,Dj,pfj,hyzk,hyyh,zyhjg,kcsl,je,hxsdh,yyy,jj,ysbh,ysmc,cm) values ("); 
  	        strSql.Append("	"+ model.DjLsh+","+ model.DjBth+",'"+ model.DjState+"',"+ model.hh+",'"+ model.tmh+"','"+ model.spbh+"','"+ model.spmc+"','"+ model.gg+"','"+ model.dw+"',"+ model.sl+","+ model.Dj+","+ model.pfj+","+ model.hyzk+","+ model.hyyh+","+ model.zyhjg+","+ model.kcsl+","+ model.je+",'"+ model.hxsdh+"','"+ model.yyy+"',"+ model.jj+",'"+ model.ysbh+"','"+ model.ysmc+"','" +model.cm+"'	 ) "); 
           return strSql.ToString(); 
  		} 
  		 
  		 
  		/// <summary> 
  		/// 更新一条数据 
  		/// </summary> 
  		public bool Update(xskdB_Entity model) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("update xskdB set "); 
                      strSql.Append(" DjLsh = @DjLsh,"); 
              strSql.Append(" DjBth = @DjBth,"); 
              strSql.Append(" DjState = @DjState,"); 
              strSql.Append(" hh = @hh,"); 
              strSql.Append(" tmh = @tmh,"); 
              strSql.Append(" spbh = @spbh,"); 
              strSql.Append(" spmc = @spmc,"); 
              strSql.Append(" gg = @gg,"); 
              strSql.Append(" dw = @dw,"); 
              strSql.Append(" sl = @sl,"); 
              strSql.Append(" Dj = @Dj,"); 
              strSql.Append(" pfj = @pfj,"); 
              strSql.Append(" hyzk = @hyzk,"); 
              strSql.Append(" hyyh = @hyyh,"); 
              strSql.Append(" zyhjg = @zyhjg,"); 
              strSql.Append(" kcsl = @kcsl,"); 
              strSql.Append(" je = @je,"); 
              strSql.Append(" hxsdh = @hxsdh,"); 
              strSql.Append(" yyy = @yyy,"); 
              strSql.Append(" jj = @jj,"); 
              strSql.Append(" ysbh = @ysbh,"); 
              strSql.Append(" ysmc = @ysmc,"); 
              strSql.Append(" cm = @cm"); 
  			strSql.Append(" where   "); 
  						 
           SqlParameter[] parameters = { 
                      new SqlParameter("@DjLsh", SqlDbType.Int,4) ,              
              new SqlParameter("@DjBth", SqlDbType.Int,4) ,              
              new SqlParameter("@DjState", SqlDbType.Char,10) ,              
              new SqlParameter("@hh", SqlDbType.Int,4) ,              
              new SqlParameter("@tmh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@spbh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@spmc", SqlDbType.VarChar,50) ,              
              new SqlParameter("@gg", SqlDbType.VarChar,50) ,              
              new SqlParameter("@dw", SqlDbType.VarChar,50) ,              
              new SqlParameter("@sl", SqlDbType.Decimal,9) ,              
              new SqlParameter("@Dj", SqlDbType.Money) ,              
              new SqlParameter("@pfj", SqlDbType.Money) ,              
              new SqlParameter("@hyzk", SqlDbType.Decimal,9) ,              
              new SqlParameter("@hyyh", SqlDbType.Decimal,9) ,              
              new SqlParameter("@zyhjg", SqlDbType.Money) ,              
              new SqlParameter("@kcsl", SqlDbType.Decimal,9) ,              
              new SqlParameter("@je", SqlDbType.Money) ,              
              new SqlParameter("@hxsdh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@yyy", SqlDbType.VarChar,50) ,              
              new SqlParameter("@jj", SqlDbType.Decimal,9) ,              
              new SqlParameter("@ysbh", SqlDbType.VarChar,50) ,              
              new SqlParameter("@ysmc", SqlDbType.VarChar,50) ,              
              new SqlParameter("@cm", SqlDbType.VarChar,50)};             
                   if (model.DjLsh != null)  
              parameters[0].Value = model.DjLsh;  
           else  
              parameters[0].Value = DBNull.Value;  
              
           if (model.DjBth != null)  
              parameters[1].Value = model.DjBth;  
           else  
              parameters[1].Value = DBNull.Value;  
              
           if (model.DjState != null)  
              parameters[2].Value = model.DjState;  
           else  
              parameters[2].Value = DBNull.Value;  
              
           if (model.hh != null)  
              parameters[3].Value = model.hh;  
           else  
              parameters[3].Value = DBNull.Value;  
              
           if (model.tmh != null)  
              parameters[4].Value = model.tmh;  
           else  
              parameters[4].Value = DBNull.Value;  
              
           if (model.spbh != null)  
              parameters[5].Value = model.spbh;  
           else  
              parameters[5].Value = DBNull.Value;  
              
           if (model.spmc != null)  
              parameters[6].Value = model.spmc;  
           else  
              parameters[6].Value = DBNull.Value;  
              
           if (model.gg != null)  
              parameters[7].Value = model.gg;  
           else  
              parameters[7].Value = DBNull.Value;  
              
           if (model.dw != null)  
              parameters[8].Value = model.dw;  
           else  
              parameters[8].Value = DBNull.Value;  
              
           if (model.sl != null)  
              parameters[9].Value = model.sl;  
           else  
              parameters[9].Value = DBNull.Value;  
              
           if (model.Dj != null)  
              parameters[10].Value = model.Dj;  
           else  
              parameters[10].Value = DBNull.Value;  
              
           if (model.pfj != null)  
              parameters[11].Value = model.pfj;  
           else  
              parameters[11].Value = DBNull.Value;  
              
           if (model.hyzk != null)  
              parameters[12].Value = model.hyzk;  
           else  
              parameters[12].Value = DBNull.Value;  
              
           if (model.hyyh != null)  
              parameters[13].Value = model.hyyh;  
           else  
              parameters[13].Value = DBNull.Value;  
              
           if (model.zyhjg != null)  
              parameters[14].Value = model.zyhjg;  
           else  
              parameters[14].Value = DBNull.Value;  
              
           if (model.kcsl != null)  
              parameters[15].Value = model.kcsl;  
           else  
              parameters[15].Value = DBNull.Value;  
              
           if (model.je != null)  
              parameters[16].Value = model.je;  
           else  
              parameters[16].Value = DBNull.Value;  
              
           if (model.hxsdh != null)  
              parameters[17].Value = model.hxsdh;  
           else  
              parameters[17].Value = DBNull.Value;  
              
           if (model.yyy != null)  
              parameters[18].Value = model.yyy;  
           else  
              parameters[18].Value = DBNull.Value;  
              
              parameters[19].Value = model.xh;  
              
           if (model.jj != null)  
              parameters[20].Value = model.jj;  
           else  
              parameters[20].Value = DBNull.Value;  
              
           if (model.ysbh != null)  
              parameters[21].Value = model.ysbh;  
           else  
              parameters[21].Value = DBNull.Value;  
              
           if (model.ysmc != null)  
              parameters[22].Value = model.ysmc;  
           else  
              parameters[22].Value = DBNull.Value;  
              
           if (model.cm != null)  
              parameters[23].Value = model.cm;  
           else  
              parameters[23].Value = DBNull.Value;  
              
           int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters); 
  			if (rows > 0) 
  			{ 
  				return true; 
  			} 
  			else 
  			{ 
  				return false; 
  			} 
  		} 
  		 
  		 
  		/// <summary> 
  		/// 更新一条数据(字符串) 2016-07-13更新 
  		///   2017-03-23更新 minjie 
  		/// </summary> 
  		public  string  UpdateStr(xskdB_Entity model) 
  		{ 
  				if(model.DjLsh==null) 
  				{ 
  					model.DjLsh=0; 
  				} 
  				if(model.DjBth==null) 
  				{ 
  					model.DjBth=0; 
  				} 
  				if(model.DjState==null) 
  				{ 
  					model.DjState="";  
  				} 
  				if(model.hh==null) 
  				{ 
  					model.hh=0; 
  				} 
  				if(model.tmh==null) 
  				{ 
  					model.tmh="";  
  				} 
  				if(model.spbh==null) 
  				{ 
  					model.spbh="";  
  				} 
  				if(model.spmc==null) 
  				{ 
  					model.spmc="";  
  				} 
  				if(model.gg==null) 
  				{ 
  					model.gg="";  
  				} 
  				if(model.dw==null) 
  				{ 
  					model.dw="";  
  				} 
  				if(model.sl==null) 
  				{ 
  					model.sl=0; 
  				} 
  				if(model.Dj==null) 
  				{ 
  					model.Dj=0; 
  				} 
  				if(model.pfj==null) 
  				{ 
  					model.pfj=0; 
  				} 
  				if(model.hyzk==null) 
  				{ 
  					model.hyzk=0; 
  				} 
  				if(model.hyyh==null) 
  				{ 
  					model.hyyh=0; 
  				} 
  				if(model.zyhjg==null) 
  				{ 
  					model.zyhjg=0; 
  				} 
  				if(model.kcsl==null) 
  				{ 
  					model.kcsl=0; 
  				} 
  				if(model.je==null) 
  				{ 
  					model.je=0; 
  				} 
  				if(model.hxsdh==null) 
  				{ 
  					model.hxsdh="";  
  				} 
  				if(model.yyy==null) 
  				{ 
  					model.yyy="";  
  				} 
  				if(model.xh==null) 
  				{ 
  					model.xh=0; 
  				} 
  				if(model.jj==null) 
  				{ 
  					model.jj=0; 
  				} 
  				if(model.ysbh==null) 
  				{ 
  					model.ysbh="";  
  				} 
  				if(model.ysmc==null) 
  				{ 
  					model.ysmc="";  
  				} 
  				if(model.cm==null) 
  				{ 
  					model.cm="";  
  				} 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("update xskdB set "); 
              strSql.Append(" DjLsh = "+model.DjLsh+","); 
              strSql.Append(" DjBth = "+model.DjBth+","); 
              strSql.Append(" DjState ='"+ model.DjState+"',"); 
              strSql.Append(" hh = "+model.hh+","); 
              strSql.Append(" tmh ='"+ model.tmh+"',"); 
              strSql.Append(" spbh ='"+ model.spbh+"',"); 
              strSql.Append(" spmc ='"+ model.spmc+"',"); 
              strSql.Append(" gg ='"+ model.gg+"',"); 
              strSql.Append(" dw ='"+ model.dw+"',"); 
              strSql.Append(" sl = "+model.sl+","); 
              strSql.Append(" Dj = "+model.Dj+","); 
              strSql.Append(" pfj = "+model.pfj+","); 
              strSql.Append(" hyzk = "+model.hyzk+","); 
              strSql.Append(" hyyh = "+model.hyyh+","); 
              strSql.Append(" zyhjg = "+model.zyhjg+","); 
              strSql.Append(" kcsl = "+model.kcsl+","); 
              strSql.Append(" je = "+model.je+","); 
              strSql.Append(" hxsdh ='"+ model.hxsdh+"',"); 
              strSql.Append(" yyy ='"+ model.yyy+"',"); 
              strSql.Append(" jj = "+model.jj+","); 
              strSql.Append(" ysbh ='"+ model.ysbh+"',"); 
              strSql.Append(" ysmc ='"+ model.ysmc+"',"); 
              strSql.Append(" cm = '"+model.cm+"'"); 
  			strSql.Append(" where   "); 
  						 
           return strSql.ToString(); 
  		} 
  		 
  		 
  		/// <summary> 
  		/// 删除一条数据 
  		/// </summary> 
  		public bool Delete() 
  		{ 
  			 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("delete from xskdB "); 
  			strSql.Append(" where  "); 
           SqlParameter[] parameters = { };  
  			 
   
  			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters); 
  			if (rows > 0) 
  			{ 
  				return true; 
  			} 
  			else 
  			{ 
  				return false; 
  			} 
  		} 
  		 
  		/// <summary> 
  		/// 批量删除一批数据 
  		/// </summary> 
  		public bool DeleteList(string lists ) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("delete from xskdB "); 
  			strSql.Append(" where ID in ("+ lists + ")  "); 
  			int rows=DbHelperSQL.ExecuteSql(strSql.ToString()); 
  			if (rows > 0) 
  			{ 
  				return true; 
  			} 
  			else 
  			{ 
  				return false; 
  			} 
  		} 
  		 
  		 
  		/// <summary> 
  		/// 得到一个对象实体 
  		/// </summary> 
  		public xskdB_Entity GetModel() 
  		{ 
  			 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("select  DjLsh,DjBth,DjState,hh,tmh,spbh,spmc,gg,dw,sl,Dj,pfj,hyzk,hyyh,zyhjg,kcsl,je,hxsdh,yyy,xh,jj,ysbh,ysmc,cm");			 
  	        strSql.Append("  from xskdB"); 
  			strSql.Append(" where   "); 
           SqlParameter[] parameters = { };  
  			 
  			 
  			xskdB_Entity model=new xskdB_Entity(); 
  			DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters); 
  		        DataTable dt=ds.Tables[0];	  
  				return DataTableToEntity(dt); 
  		} 
  		 
  		 
  		 
  		 
  		/// <summary> 
  		/// 将数据集(DataTable)转换 对象 xskdB_Entity
  		/// 创建人：minjie 
  		/// 创建时间:2019-01-17 01:36:37 
  		/// </summary> 
  		public xskdB_Entity DataTableToEntity(DataTable dt) 
  		{ 
  			xskdB_Entity model=new xskdB_Entity(); 
  			 
  			if(dt!=null&&dt.Rows.Count>0) 
  			{ 
  				if(dt.Rows[0]["DjLsh"]!=null&&dt.Rows[0]["DjLsh"].ToString()!="") 
  				{ 
  					model.DjLsh=int.Parse(dt.Rows[0]["DjLsh"].ToString()); 
  				} 
  				if(dt.Rows[0]["DjBth"]!=null&&dt.Rows[0]["DjBth"].ToString()!="") 
  				{ 
  					model.DjBth=int.Parse(dt.Rows[0]["DjBth"].ToString()); 
  				} 
  				model.DjState= dt.Rows[0]["DjState"].ToString(); 
  				if(dt.Rows[0]["hh"]!=null&&dt.Rows[0]["hh"].ToString()!="") 
  				{ 
  					model.hh=int.Parse(dt.Rows[0]["hh"].ToString()); 
  				} 
  				model.tmh= dt.Rows[0]["tmh"].ToString(); 
  				model.spbh= dt.Rows[0]["spbh"].ToString(); 
  				model.spmc= dt.Rows[0]["spmc"].ToString(); 
  				model.gg= dt.Rows[0]["gg"].ToString(); 
  				model.dw= dt.Rows[0]["dw"].ToString(); 
  				if(dt.Rows[0]["sl"]!=null&&dt.Rows[0]["sl"].ToString()!="") 
  				{ 
  					model.sl=decimal.Parse(dt.Rows[0]["sl"].ToString()); 
  				} 
  				if(dt.Rows[0]["Dj"]!=null&&dt.Rows[0]["Dj"].ToString()!="") 
  				{ 
  					model.Dj=decimal.Parse(dt.Rows[0]["Dj"].ToString()); 
  				} 
  				if(dt.Rows[0]["pfj"]!=null&&dt.Rows[0]["pfj"].ToString()!="") 
  				{ 
  					model.pfj=decimal.Parse(dt.Rows[0]["pfj"].ToString()); 
  				} 
  				if(dt.Rows[0]["hyzk"]!=null&&dt.Rows[0]["hyzk"].ToString()!="") 
  				{ 
  					model.hyzk=decimal.Parse(dt.Rows[0]["hyzk"].ToString()); 
  				} 
  				if(dt.Rows[0]["hyyh"]!=null&&dt.Rows[0]["hyyh"].ToString()!="") 
  				{ 
  					model.hyyh=decimal.Parse(dt.Rows[0]["hyyh"].ToString()); 
  				} 
  				if(dt.Rows[0]["zyhjg"]!=null&&dt.Rows[0]["zyhjg"].ToString()!="") 
  				{ 
  					model.zyhjg=decimal.Parse(dt.Rows[0]["zyhjg"].ToString()); 
  				} 
  				if(dt.Rows[0]["kcsl"]!=null&&dt.Rows[0]["kcsl"].ToString()!="") 
  				{ 
  					model.kcsl=decimal.Parse(dt.Rows[0]["kcsl"].ToString()); 
  				} 
  				if(dt.Rows[0]["je"]!=null&&dt.Rows[0]["je"].ToString()!="") 
  				{ 
  					model.je=decimal.Parse(dt.Rows[0]["je"].ToString()); 
  				} 
  				model.hxsdh= dt.Rows[0]["hxsdh"].ToString(); 
  				model.yyy= dt.Rows[0]["yyy"].ToString(); 
  				if(dt.Rows[0]["xh"]!=null&&dt.Rows[0]["xh"].ToString()!="") 
  				{ 
  					model.xh=int.Parse(dt.Rows[0]["xh"].ToString()); 
  				} 
  				if(dt.Rows[0]["jj"]!=null&&dt.Rows[0]["jj"].ToString()!="") 
  				{ 
  					model.jj=decimal.Parse(dt.Rows[0]["jj"].ToString()); 
  				} 
  				model.ysbh= dt.Rows[0]["ysbh"].ToString(); 
  				model.ysmc= dt.Rows[0]["ysmc"].ToString(); 
  				model.cm= dt.Rows[0]["cm"].ToString(); 
  				return model; 
  			} 
  			else 
  			{ 
  				return null; 
  			} 
  		} 
  		 
  		/// <summary> 
  		/// 分页获取数据列表 
  		/// </summary> 
  		public DataSet GetListByPage(string strWhere, string orderby, int startIndex, int endIndex) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  		 strSql.Append("SELECT * FROM ( "); 
  		 strSql.Append(" SELECT ROW_NUMBER() OVER ("); 
  if (!string.IsNullOrEmpty(orderby.Trim())) 
 { 
    strSql.Append("order by " ); 
 } 
else  
 { 
     strSql.Append("order by  desc"); 
 } 
		 strSql.Append(")AS Row, T.*  from xskdB T "); 
  		 if (!string.IsNullOrEmpty(strWhere.Trim()))  
  			{ 
  			 strSql.Append(" WHERE " + strWhere); 
  			} 
  		    strSql.Append(" ) TT"); 
  	        strSql.AppendFormat(" WHERE TT.Row between {0} and {1}", startIndex, endIndex);			return DbHelperSQL.Query(strSql.ToString()); 
  		} 
  		 
  		 
  		/// <summary> 
  		/// 获得数据列表 
  		/// </summary> 
  		public DataSet GetList(string strWhere) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("select * "); 
  			strSql.Append(" FROM xskdB "); 
  			if(strWhere.Trim()!="") 
  			{ 
  				strSql.Append(" where "+strWhere); 
  			} 
  			return DbHelperSQL.Query(strSql.ToString()); 
  		} 
  		 
  		/// <summary> 
  		/// 获得前几行数据 
  		/// </summary> 
  		public DataSet GetList(int Top,string strWhere,string filedOrder) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("select "); 
  			if(Top>0) 
  			{ 
  				strSql.Append(" top "+Top.ToString()); 
  			} 
  			strSql.Append(" * "); 
  			strSql.Append(" FROM xskdB "); 
  			if(strWhere.Trim()!="") 
  			{ 
  				strSql.Append(" where "+strWhere); 
  			} 
  			strSql.Append(" order by " + filedOrder); 
  			return DbHelperSQL.Query(strSql.ToString()); 
  		} 
  		/// <summary> 
  		/// 批量处理  
  		/// </summary> 
  		public int ExecuteSqlTran(List<string> ls,ref string error) 
  		{ 
  			return DbHelperSQL.ExecuteSqlTran(ls,ref   error); 
  		} 
  		 
  		/// <summary> 
  		/// 执行sql语句  
  		/// </summary> 
  		public int ExecuteSql(string sql) 
  		{ 
  			return DbHelperSQL.ExecuteSql(sql); 
  		} 
  		 
  		/// <summary> 
  		/// 执行sql语句  
  		/// </summary> 
  		public string GetSingle(string sql) 
  		{ 
  			object obj= DbHelperSQL.GetSingle(sql); 
  			 if (obj != null) 
  			 { 
  			    return obj.ToString(); 
  		     } 
  		     else 
  		        return ""; 
  		} 
  		 
  		/// <summary> 
  		/// 执行sql语句  
  		/// </summary> 
  		public DataTable  ExecuteDt(string sql) 
  		{ 
  			return DbHelperSQL.ExecuteDt(sql); 
  		} 
  		 
  		 
  		/// <summary> 
  		/// 获得记录条数 
  		/// </summary> 
  		public int GetRecordCount(string strWhere) 
  		{ 
  			StringBuilder strSql=new StringBuilder(); 
  			strSql.Append("select count(1) "); 
  			strSql.Append(" FROM xskdB "); 
  			if(strWhere.Trim()!="") 
  			{ 
  				strSql.Append(" where "+strWhere); 
  			} 
  		   object obj=	DbHelperSQL.GetSingle(strSql.ToString()); 
  			if(obj!=null && obj.ToString()!="") 
  			{ 
              	return Convert.ToInt32(obj); 
  			} 
  			else 
  			return 0; 
  		} 
   
      
  	} 
  
}
